/* 全局样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 登录页样式 */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #1e3a8a;
    background-image: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
}

.login-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    width: 400px;
    padding: 30px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h1 {
    color: #1e3a8a;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.btn {
    padding: 10px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #2563eb;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: #1e40af;
}

.error-message {
    color: #ef4444;
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
    min-height: 20px;
}

/* 主界面布局 */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: #1e3a8a;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-items {
    list-style: none;
    padding: 20px 0;
    flex-grow: 1;
}

.nav-item a {
    display: block;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item.active a, .nav-item a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.content {
    flex-grow: 1;
    margin-left: 250px;
    padding: 20px;
}

.content-section {
    display: none;
    animation: fadeIn 0.5s;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 控制面板样式 */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-gap: 20px;
    margin-top: 20px;
}

.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.card h3 {
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    color: #1e3a8a;
}

.card p {
    margin-bottom: 8px;
}

/* 设备升级样式 */
.upgrade-container {
    margin-top: 20px;
}

.upgrade-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.upgrade-card h2 {
    margin-bottom: 15px;
    color: #1e3a8a;
}

.version-info {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
}

.version-info p {
    margin-right: 20px;
    min-width: 200px;
    margin-bottom: 8px;
}

.upgrade-action {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.upload-firmware {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.upload-firmware h3 {
    margin-bottom: 10px;
}

.upload-firmware input[type="file"] {
    margin-bottom: 10px;
}

.upgrade-progress {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.progress-container {
    display: flex;
    align-items: center;
    margin: 15px 0;
}

.progress-bar {
    flex-grow: 1;
    height: 20px;
    background-color: #eee;
    border-radius: 10px;
    overflow: hidden;
    margin-right: 10px;
}

.progress-fill {
    height: 100%;
    background-color: #2563eb;
    width: 0%;
    transition: width 0.3s;
}

.update-history {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.update-logs {
    max-height: 300px;
    overflow-y: auto;
}

.update-log-item {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
}

.update-log-item:last-child {
    border-bottom: none;
}

.update-log-date {
    color: #6b7280;
    font-size: 12px;
}

/* RTSP 视频预览样式 */
.rtsp-container {
    margin-top: 20px;
}

.rtsp-player {
    background: #000;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#rtspPlayer {
    width: 100%;
    height: 100%;
    background-color: #000;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
}

.rtsp-player video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.rtsp-controls {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.rtsp-url-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.rtsp-url-input input {
    flex-grow: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.rtsp-buttons {
    display: flex;
    gap: 10px;
}

/* 日志管理样式 */
.logs-container {
    margin-top: 20px;
}

.logs-filter {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    grid-gap: 15px;
    align-items: end;
}

.logs-filter .form-group {
    margin-bottom: 0;
}

.logs-filter .date-range {
    display: flex;
    align-items: center;
    gap: 5px;
}

.logs-filter .date-range input {
    flex: 1;
}

.logs-filter .buttons-group {
    display: flex;
    gap: 10px;
}

.logs-table-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
}

.logs-table th,
.logs-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.logs-table th {
    background-color: #f5f5f5;
    font-weight: 500;
}

.logs-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

/* 状态标签 */
.log-level {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
    text-align: center;
}

.log-level-info {
    background-color: #3b82f6;
    color: white;
}

.log-level-warning {
    background-color: #f59e0b;
    color: white;
}

.log-level-error {
    background-color: #ef4444;
    color: white;
}

.log-level-debug {
    background-color: #6b7280;
    color: white;
}

/* 设备配置样式 */
.settings-container {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    grid-gap: 20px;
}

.settings-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.settings-card h2 {
    margin-bottom: 15px;
    color: #1e3a8a;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 5px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 400px;
    position: relative;
}

.close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.modal-buttons .btn {
    min-width: 100px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        overflow: hidden;
    }
    
    .sidebar-header h3,
    .nav-item span,
    .sidebar-footer .btn span {
        display: none;
    }
    
    .content {
        margin-left: 60px;
    }
    
    .dashboard-cards,
    .settings-container {
        grid-template-columns: 1fr;
    }
    
    .upgrade-action,
    .rtsp-url-input {
        flex-direction: column;
    }
    
    .rtsp-url-input input {
        margin-bottom: 10px;
    }
    
    .logs-filter {
        flex-direction: column;
        align-items: stretch;
    }
}

/* 辅助类 */
.hidden {
    display: none;
}
